package stuttgart.uni.pedometer;

import android.os.Parcel;
import android.os.Parcelable;

//Objects of this class are used to exchange data between Service, GPXDataSaver and Activity
public class PedometerData implements Parcelable{
	
	private long time = 0;
	private double latitude = 0;
	private double longitude = 0;
	private double distanceTraveled = 0;
	private double averageSpeed = 0;
	private double heading = 0;
	private int steps = 0;
	
	
	public static final Parcelable.Creator<PedometerData> CREATOR = new Parcelable.Creator<PedometerData>() {
		public PedometerData createFromParcel(Parcel in) {
			return new PedometerData(in);
		}

		public PedometerData[] newArray(int size) {
			return new PedometerData[size];
		}
	};

	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void readFromParcel(Parcel in) {
		time = in.readLong();
		latitude = in.readDouble();
		longitude = in.readDouble();
		distanceTraveled = in.readDouble();
		averageSpeed = in.readDouble();
		heading = in.readDouble();
		steps = in.readInt();
	}
	
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeLong(time);
		dest.writeDouble(latitude);
		dest.writeDouble(longitude);
		dest.writeDouble(distanceTraveled);
		dest.writeDouble(averageSpeed);
		dest.writeDouble(heading);
		dest.writeInt(steps);
	}
	
	private PedometerData(Parcel in) {
        readFromParcel(in);
    }
	
	
	public PedometerData(long time,double latitude, double longitude,
			double distanceTraveled, double averageSpeed, double heading, int steps) {
		
		this.time = time;
		this.latitude = latitude;
		this.longitude = longitude;
		this.distanceTraveled = distanceTraveled;
		this.averageSpeed = averageSpeed;
		this.heading = heading;
		this.steps = steps;
	}

	public long getTime() {
		return time;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public double getDistanceTraveled() {
		return distanceTraveled;
	}

	public double getAverageSpeed() {
		return averageSpeed;
	}

	public double getHeading() {
		return heading;
	}

	public int getSteps() {
		return steps;
	}

}
